{include file="public/header"}
    <style type="text/css">
    	#wrapper {
            width: 100%;
            position: absolute;
            left: 0;
            top:80px;
            overflow: hidden;
            z-index: 1;
            /* 防止本机Windows上的触摸事件 */
            -ms-touch-action: none;
            /* 防止callout tap-hold和文本的选择 */
            -webkit-touch-callout: none;
            -webkit-user-select: none;
            -moz-user-select: none;
            -ms-user-select: none;
            user-select: none;
            /* 防止文本调整取向变化对web应用程序很有用 */
            -webkit-text-size-adjust: none;
            -moz-text-size-adjust: none;
            -ms-text-size-adjust: none;
            -o-text-size-adjust: none;
            text-size-adjust: none;
			height: 300px;
        }
        .pull-loading {
            text-align: center;
            height: 40px;
            line-height: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
			color: #fff;
        }
        .w_section3 .w_3{
            padding-top: 0px !important;
        }
        .xi_section1 .center1 .pp1 .a1{float:none;}
    </style>
    <script type="text/javascript">
    function countDown(obj,endTime){
        var time_start = new Date().getTime(); //设定当前时间
        var time_end =  parseInt(endTime); //设定目标时间
        // 计算时间差
        var time_distance = time_end - time_start;
		if(time_distance < 0){  // 日期已过
			console.log(obj);
			$(obj).text("已到期");//加载数据后，发现已经过期了，没有倒计时的必要
			return false;
		}
        // 天
        var int_day = Math.floor(time_distance/86400000);
        time_distance -= int_day * 86400000;
        // 时
        var int_hour = Math.floor(time_distance/3600000);
        time_distance -= int_hour * 3600000;
        // 分
        var int_minute = Math.floor(time_distance/60000);
        time_distance -= int_minute * 60000;
        // 秒
        var int_second = Math.floor(time_distance/1000);
        // 时分秒为单数时、前面加零
        if(int_day < 10 && int_day > 0){
            int_day = "0" + int_day;
        }
        if(int_hour < 10){
            int_hour = "0" + int_hour;
        }
        if(int_minute < 10){
            int_minute = "0" + int_minute;
        }
        if(int_second < 10){
            int_second = "0" + int_second;
        }
        if(int_day<=0 && int_hour<=0 && int_minute <=0 && int_second<=0){
            console.log(obj);
            $(obj).text("已到期");//加载数据后，发现已经过期了，没有倒计时的必要
            return false;
        }
        // 显示时间
        if(int_day>0){
            var result = parseInt(int_day)+"天"+int_hour+"小时"+int_minute+"分"+int_second+'秒';
		}else{
            var result = int_hour+"小时"+int_minute+"分"+int_second+'秒';
		}
        $(obj).text(result);
        // 设置定时器
        setTimeout("countDown("+"'"+obj+"'"+","+endTime+")",1000);
    }
    </script>
    <style type="text/css">
    #sred{color:red;}
		.zhuan_li{
			border: 1px solid #04c5f0;
		}
	.zu_section1 ul  li{
			border-right: 1px solid #04c5f0;
		width: 24.7% !important;
		}
	.zu_section1 ul  li:last-child{
		border-right: none !important;
	}
    </style>
<body class="she_body">
<div class="bg_fixed_v10_1"></div>
	<div class="sectionY sectionY_tttt">
        <a href="{:url('User/index')}">
			<img src="__PUBLIC__/home/images/v10_a9.png" alt="" class="a1">
		</a>
		<p class="p1">
			<span class="ppp_title">转让记录</span>
		</p>
	</div>
	<div class="kong1"></div>
	<div class="zu_section1 clearfix">
		<ul class="zhuan_li clearfix">
			<li {if condition="$types eq 1"} class='select' {/if}>
				<a href="{:url('Rent/transfer',['types'=>1])}">待转让</a>
			</li>
			<li {if condition="$types eq 2"} class='select' {/if} >
				<a href="{:url('Rent/transfer',['types'=>2])}">转让中</a>
			</li>
			<li {if condition="$types eq 3"} class='select' {/if} >
				<a href="{:url('Rent/transfer',['types'=>3])}">已完成</a>
			</li>
			<li {if condition="$types eq 4"} class='select' {/if} >
				<a href="{:url('Rent/transfer',['types'=>4])}">取消/申诉</a>
			</li>
		</ul>
	</div>
<style>
	.trtr{
		padding: 10px;
	}
	.trtr .k1{
		background: url("__PUBLIC__/home/images/v10_a19.png");
		background-size: 100% 100%;
		padding: 10px;
	}
</style>
    <div class="zu_section2">
		   <div class="container" >
                <div id='wrapper' >
                    <div id="scroller">
                        <div class="trtr">

                            {volist name='list' id='v'}
                                    <div class="k1">
                    					<div class="f1">
                    						<span class="s1">订单编号：{$v.ctime}-{$v.id}</span>
											<span class="s2">待转让</span>
                    					</div>
                    					<div class="f2">
                    						<p class="p1">
                    							<span class="s1">产品名称：</span>
                    							<span class="s2 sred">{$v.title}</span>
                    						</p>
                    						<p class="p1">
                    							<span class="s1">应收费用：</span>
                    							<span class="s2 sred">{$v.basicprice}</span>
                    						</p>
                    						<p class="p1">
                    							<span class="s1">合约收益：</span>
                    							<span class="s2 sbla">{$v.daynum}天/{$v.earnpercent}%</span>
                    						</p>
                    						<p class="p1">
                    							<span class="s1">抢购时间：</span>
                    							<span class="s2">{$v.ctime|date='Y-m-d H:i:s',###}</span>
                    						</p>
<!--                                    <?php if($v['peiduistatus']==2){ ?>-->
<!--                                        {if condition="$v['paystatus'] eq 0"}-->
<!--                                            <p class="p1">-->
<!--                    							<span class="s1">对方付款剩余时间：</span>-->
<!--                                                <span class="s2 sred" id='oneTime{$v.id}'></span>-->
<!--                                                <?php $peiduitime = ($v['peiduitime']+config('setting.pay_limit_time')*60); ?>-->
<!--                                                <script>countDown('#oneTime'+{$v.id},parseInt({$peiduitime}*1000));</script>-->
<!--                    						</p>-->
<!--                                        {/if}-->
<!--                                        {if condition="$v['paystatus'] eq 1"}-->
<!--                                            <p class="p1">-->
<!--                    							<span class="s1">确认收款剩余时间：</span>-->
<!--                                                <span class="s2 sred" id='oneTime{$v.id}'></span>-->
<!--                                                <?php $peiduitime = ($v['paytime']+config('setting.pay_limit_time')*60); ?>-->
<!--                                                <script>countDown('#oneTime'+{$v.id},parseInt({$peiduitime}*1000));</script>-->
<!--                    						</p>-->
<!--                                        {/if}-->
<!--                                    <?php } ?>-->

                    						<p class="p1">
                    							<span class="s1">订单状态：</span>
                                                {if condition="$v['peiduistatus'] lt 2"}
                                                        <span class="s2 sorg">待转让</span>
                                                {else /}
                                                    {if condition="$v['paystatus'] eq 1"}
                                                        <span class="s2 sorg">转让中</span>
                                                    {/if}
                                                    {if condition="$v['paystatus'] eq 2"}
                                                        <span class="s2 sorg">已完成</span>
                                                    {/if}
                                                {/if}

                    						</p>
                    					</div>
                    					<div class="f3 clearfix">
                    						<a href="{:url('Rent/transfercon')}?id={$v.id}" class="a1">订单详情</a>
                                            {if condition="$v['paystatus'] eq 1"}
                                                <a data-href='{:url("Rent/suregetmoney",['id'=>$v["id"]])}' href='javascript:;' onclick='checkPayPwd(this)' class="a2">确认收到款项</a>
                                            {/if}
                    					</div>
                    				</div>


                            {/volist}

                        </div>
                        <div class="pull-loading">上拉加载</div>
                    </div>

        </div>
    </div>
	</div>
</body>
<style>

	.footer1 .p1{
		margin-top:1px;font-weight: bold;
	}

</style>
<!--{include file="public/newfoot"}-->
<script type="text/javascript">
    $(function(){
        var dd = $("#wrapper").offset().top;
        $("#wrapper").css("height",($(window).height()-dd-80));
        $("#wrapper").css("top",dd+20);
    })

	//检验交易密码
	function checkPayPwd(o) {
		var url = $(o).data('href');
		layer.prompt({'title':'请输入交易密码'}, function (res) {
			$.post('{:url("Rent/checkPwd")}', {pwd:res}, function (r) {
				if(r.result_code == 0){
					console.log("success=>",r)
					location.href=url
				}else{
					console.log("error=>",r)
					layer.msg(r.result_info)
				}
			})
		})
	}
</script>
<script>
	$(function(){
		var d = $(window).height()-46-120;
		$(".zu_section2").css("height",d);
	})
    var myscroll = new iScroll("wrapper", {
        onScrollMove: function () { //拉动时
            //上拉加载
            if (this.y < this.maxScrollY) {
                $(".pull-loading").html("释放加载");
                $(".pull-loading").addClass("loading");
            } else {
                $(".pull-loading").html("上拉加载");
                $(".pull-loading").removeClass("loading");
            }
        },
        onScrollEnd: function () { //拉动结束时
            //上拉加载
            if ($(".pull-loading").hasClass('loading')) {
                $(".pull-loading").html("加载中...");
                pullOnLoad();
            }
        }
    });
    //上拉加载函数,ajax
    var num = 1;
    function pullOnLoad() {
        num++;
        $.ajax({
            type:'post',
            url:"{:url('Rent/ajaxmorerenttransfer')}?types={$types}",
            data:{page:num},
            cache:false,
            dataType:'JSON',
            success:function(data){
                if(data.length<=0){
                    $('.pull-loading').html("已加载全部");
                }else{
                    var html = '';
                    for(var i=0;i<data.length;i++){
                        html += '<div class="k1">';
                        html +='    <div class="f1">';
                        html +='        <img src="__PUBLIC__/home/images/a58.png" alt="" class="im1">';
                        html +='        <span class="s1">订单编号：'+data[i]['ctime2']+'-'+data[i]['id']+'</span>';
                        html +='    </div>';
                        html +='    <div class="f2">';
                        html +='        <p class="p1">';
                        html +='            <span class="s1">产品名称：</span>';
                        html +='            <span class="s2 sred">'+data[i]['title']+'</span>';
                        html +='        </p>';
                        html +='        <p class="p1">';
                        html +='            <span class="s1">应收费用：</span>';
                        html +='            <span class="s2 sred">'+data[i]['price']+'</span>';
                        html +='        </p>';
                        html +='        <p class="p1">';
                        html +='            <span class="s1">合约收益：</span>';
                        html +='            <span class="s2 sbla">'+data[i]['daynum']+'天/'+data[i]['earnpercent']+'%</span>';
                        html +='        </p>';
                        html +='        <p class="p1">';
                        html +='            <span class="s1">抢购时间：</span>';
                        html +='            <span class="s2">'+data[i]['ctime']+'</span>';
                        html +='        </p>';
                    // if(data[i]['peiduistatus']==2){
                    //     if(data[i]['paystatus']==0){
                    //         html += '<p class="p1">';
                    //         html += '<span class="s1">对方付款剩余时间：</span>';
                    //         html += '<span class="s2 sred" id="oneTime'+data[i]['id']+'"></span>';
                    //         html += '</p>';
                    //     }
                    //     if(data[i]['paystatus']==1){
                    //         html += '<p class="p1">';
                    //         html += '<span class="s1">确认收款剩余时间：</span>';
                    //         html += '<span class="s2 sred" id="oneTime'+data[i]['id']+'"></span>';
                    //         html += '</p>';
                    //     }
                    // }





                        html +='        <p class="p1">';
                        html +='            <span class="s1">订单状态：</span>';
                        if(data[i]['peiduistatus']<2){
                            html +='    <span class="s2 sorg">待转让</span>';
                        }else{
                            if(data[i]['paystatus']==1){
                                html +='    <span class="s2 sorg">转让中</span>';
                            }
                            if(data[i]['paystatus']==2){
                                html +='    <span class="s2 sorg">已完成</span>';
                            }
                        }
                        html +='        </p>';
                        html += ' </div>';
                        html += '<div class="f3 clearfix">';
                        var url = "{:url('Rent/payrentok')}?id="+data[i]['id'];
                        var orderconurl = "{:url('Rent/transfercon')}?id="+data[i]['id'];
                        html += '<a href="'+orderconurl+'" class="a1">订单详情</a>';
                        if(data[i]['paystatus']==1){
                            var getmoney = '{:url("Rent/suregetmoney")}?id='+data[i]['id'];
                            html +='<a class="a2" href="'+getmoney+'">确认收到款项</a>';
                        }
                        html += '       </div>';
                        html += '   </div>';
                        html += '</div>';
                    }
                    $("#scroller .trtr").append(html);
                    /*循环执行这个js*/
                    for(var i=0;i<data.length;i++){
                        if(data[i]['paystatus']==0){
                            countDown("#oneTime"+data[i]['id'],parseInt(data[i]['peiduitime3']*1000));
                        }
                        if(data[i]['paystatus']>0){
                            countDown("#oneTime"+data[i]['id'],parseInt(data[i]['recive_time']*1000));
                        }
                    }
                    $('.pull-loading').html("上拉加载");
                }
				myscroll.refresh();
            }
        });
    }
    pullOnLoad();
</script>
</html>
